#pragma once
#include "common\pluginbase.h"
#include<atlstr.h>


typedef DWORD (* __stdcall lpInitDevice)(DWORD);
typedef BOOL (* __stdcall lpCloseDevice)(DWORD);
typedef BOOL (* __stdcall lpstartPreview)(DWORD);
typedef BOOL (* __stdcall lpstopPreview)(DWORD);
typedef CString (* __stdcall lpGetCodeNumber)(DWORD DeviceHandle);



class CPlugin :
	public nsPluginInstanceBase
{
public:
	CPlugin(NPP instance);
	~CPlugin(void);

	NPBool init(NPWindow* aWindow);
	void shut();
	NPBool isInitialized();

	NPObject* GetScriptableObject();
	int16_t handleEvent(void*);

private:
	NPP instance;
	NPWindow* aWindow;
	NPBool initialized;

public :
	HMODULE hDLL;
	lpInitDevice InitDevice;
	lpCloseDevice CloseDevice;
	lpstartPreview startPreview;
	lpstopPreview stopPreview;
	lpGetCodeNumber getCodeNumber;

	CString deviceId;

	DWORD m_dwDeviceHdl;
	CString num;
};